<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<head>
    <title>量化详细信息</title>
    <link href="../css/bootstrap-cerulean.css" rel="stylesheet">
    <link href="../css/charisma-app.css" rel="stylesheet">
    <link href="../js/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css">
    <style type="text/css">
        body {
            padding-bottom: 40px;
        }

        .sidebar-nav {
            padding: 9px 0;
        }
    </style>
    <script src="http://lib.sinaapp.com/js/jquery/2.2.4/jquery-2.2.4.min.js"></script>
    <script src="../js/common/public.js"></script>
    <script src="../js/base64.js"></script>
    <script src="../js/bootstrap-modal.js"></script>
    <script src="../js/My97DatePicker/WdatePicker.js"></script>

    <script type="text/javascript">
        function searchByTime() {
            var urlMsg = parseUrl(window.location.search);

            var startTime = $("#startTime").val();
            var endTime =  $("#endTime").val();

            window.location.href="classScoreRecordList.html?startTime="+startTime+"&endTime="+endTime+"&token="+urlMsg.token;

        }
        $(document).ready(function () {
            // 设置结束时间的最大可取值为today
            $('#endTime').unbind("click");
            $('#endTime').bind("click",function(){
                WdatePicker({
                    readOnly:true,
                    dateFmt:'yyyy-MM-dd ',
                    minDate:'#F{$dp.$D(\'startTime\')}',
                    maxDate:'#F{\'%y-%M-%d\'}'
                });
            });
        });

        // 开始时间值改变时,改变结束时间值得范围
        function setEndTimeDurationWhileStartTimeChange(){
            var start = $('#startTime').val(); // 格式：2017-05-01 

            // 如果选中了开始时间
            if(start != "" && start != null){
                // endMaxDate = 开始时间+29天
                start = start.replace(/-/g,"/");
                var endMaxDate = new Date(start);
                endMaxDate.setDate(endMaxDate.getDate()+7);

                // today = 今天
                var today = new Date();
                today.setHours(0);
                today.setMinutes(0);
                today.setSeconds(0);
                today.setMilliseconds(0);

                // 如果endMaxDate>today
                if(endMaxDate.getTime()>today.getTime()){
                    // 设置结束时间的最大可取值为today
                    $('#endTime').unbind("click");
                    $('#endTime').bind("click",function(){
                        WdatePicker({
                            readOnly:true,
                            dateFmt:'yyyy-MM-dd ',
                            minDate:'#F{$dp.$D(\'startTime\')}',
                            maxDate:'#F{\'%y-%M-%d\'}'
                        });
                    });
                }else{
                    // 设置结束时间的最大可取值为endMaxDate
                    $('#endTime').unbind("click");
                    $('#endTime').bind("click",function(){
                        WdatePicker({
                            readOnly:true,
                            dateFmt:'yyyy-MM-dd ',
                            minDate:'#F{$dp.$D(\'startTime\')}',
                            maxDate:'#F{$dp.$D(\'startTime\',{d:7})}'
                        });
                    });
                }
            }
            // 如果清空了开始时间,重设结束时间的范围,到今天为止
            else{
                // 设置结束时间的最大可取值为today
                $('#endTime').unbind("click");
                $('#endTime').bind("click",function(){
                    WdatePicker({
                        readOnly:true,
                        dateFmt:'yyyy-MM-dd ',
                        minDate:'#F{$dp.$D(\'startTime\')}',
                        maxDate:'#F{\'%y-%M-%d\'}'
                    });
                });
            }
        }
    </script>
</head>

<body>
<div class="container-fluid"
     style="padding-left:0px;padding-right:2px;">
    <div class="row-fluid">
        <div id="content" class="span10" style="width:100%;">
            <div class="row-fluid sortable">
                <div class="box span12">
                    <div class="box-header well">
                        <h2>
                            <i class="icon-user"></i>量化详细信息
                        </h2>
                    </div>
                    <div class="box-content" style="text-align:center">
                        <form action="" method="post">
                            <fieldset>
                                <br>
                                <br>
                                <h1>选择记录时间</h1>
                                <br>
                                <br>
                                <br>
                                <br>
                                <div class="control-group">
                                    <div class="controls">
                                        <span style="font-size:14px">选择开始时间：</span>
                                        <input type="text" style="width:190px; height:30px" id="startTime" readonly="readonly" class="Wdate"
                                               name="start_time_name" onClick="WdatePicker({readOnly:true,dateFmt:'yyyy-MM-dd ',maxDate:'#F{$dp.$D(\'endTime\')||\'%y-%M-%d\'}'})"
                                               onchange="setEndTimeDurationWhileStartTimeChange();"/>
                                    </div>
                                </div>
                                <br>
                                <br>
                                <br>
                                <br>
                                <div class="control-group">
                                    <div class="controls">
                                        <span style="font-size:14px">选择结束时间：</span>
                                        <input type="text"style="width:190px; height:30px" id="endTime" class="Wdate" name="end_time_name" readonly="readonly"/>
                                    </div>
                                </div>

                                <br>
                                <br>
                                <br>
                                <div class="form-actions">
                                    <button type="button" onclick="searchByTime()" class="btn btn-primary" style="width:100px;">查询</button>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    <button class="btn" onclick="javascript:history.go(-1);" type="reset"
                                            style="width:100px;">取消
                                    </button>
                                </div>
                            </fieldset>
                        </form>


                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>